<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //全局匹配 加 g
        let web="asasq 45455";
        console.log(web.match(/\d+/g));//['45455']
        console.log(web.match(/\d/g));//['4', '5', '4', '5', '5']

        //匹配电话号码
        let phone="唐玮:101-56468132 华夏:88-15481635";
        console.log(phone.match(/\d{2,3}-\d{7,8}/g));//['101-56468132', '88-15481635']

        //\d表示数字  \D除了数字
        console.log(phone.match(/\D+/g));//['唐玮:', '-', ' 华夏:', '-']

        //原子表 []表示里面只要上面元素 ，^表示除了什么元素。。。
        console.log(phone.match(/[^\d:-]+/g));//['唐玮', ' 华夏']

        //去除换行符,空白。制表符(space) \s
        let name=`
       7484 sasa551
        `;
  console.log(name.match(/[^\d]+/g));// ['\n       ', ' sasa', '\n        ']
  console.log(name.match(/[^\s]+/g));//['7484', 'sasa551']
    </script>
</body>
</html>